{% extends 'VentureFinishedProductBundle::layout.html.twig' %}

{% block title %}Finished Product Details{% endblock%}

{% block main %}
    {{ parent() }}

<div class="cont font-check">
    <h2 class="heading">{{ "finished products" | upper }}: {{ finishedProduct.ItemNumber | upper }}: {{ finishedProduct.ItemName | upper }}</h2>
    
    <h4 class="desc-cont">Description: {{ finishedProduct.itemDescription }}</h4>
    
    <div class="row-cont">
        <div class="row">
            <p class="left-side">Packaging: {{ finishedProduct.configPackaging.name }}</p>
            <p class="right-side">Quoting cost: {{ quoting_cost }}</p>
        </div>
    
        <div class="row">
            <p class="left-side">Tags: {{ finishedProduct.tags }}</p>
            <p class="right-side">Lowest cost: {{ lowest_cost }}</p>
        </div>
            
    </div>
    
    <div class="property-cont">
        <h4 class="desc-cont no-brd">Sales Price Points:</h4>
        
        <div class="property-row">
            <p>Standard Price</p>
            <p>{{ finishedProduct.standardCost }}</p>
        </div>
        
        {% for spCost in spCosts %}
        <div class="property-row">
            <p>{{ spCost.salesPricePoint.salesCostPoint }}</p>
            <p>{{ spCost.cost }}</p>
        </div>
        {% else %}
        <div class="property-row">
            <p class="single">There are no special price points listed</p>
        </div>
        {% endfor %}
    </div>
    
    <div class="property-cont">
        <h4 class="desc-cont no-brd">Properties:</h4>
            {% for property in properties %}
            <div class="property-row">
                {% if property.property is empty %}
                <p>N/A</p>
                {% else %}
                <p>{{ property.property.name}}</p>
                {% endif %}
                <p>{{ property.specification}}&nbsp;{{ property.specificationMath}}</p>
                {% if property.testProcedure is empty %}
                <p>N/A</p>
                {% else %}
                <p>{{ property.testProcedure.name}}</p>
                {% endif %}
            </div>
            {% else %}
            <div class="property-row">
                <p class="single">There is no property listed</p>
            </div>
            {% endfor %}
    </div>
    
    <div class="property-cont">
        <h4 class="desc-cont no-brd">Formula:</h4>
            {% for formula in formulas %}
            <div class="property-row">
                {% if formula.rawMaterial is empty %}
                <p>{{ formula.ingredient.itemNumber }}</p>
                {% elseif formula.ingredient is empty %}
                <p>{{ formula.rawMaterial.itemNumber }}</p>
                {% else %}
                <p>{{ formula.ingredient.itemNumber }} - {{ formula.rawMaterial.itemNumber}}</p>
                {% endif %}
                <p>{{ formula.amount }} %</p>
            </div>
            {% else %}
            <div class="property-row">
                <p class="single">There is no property listed</p>
            </div>
            {% endfor %}
            
            {% if total_percentage['total_amount'] is not null %}
            <div class="property-row">
                <p class="space"></p>
                <p>{{ total_percentage['total_amount'] }}% Total Percentage</p>
            </div>
            {% endif %}
    </div>
    
    <div class="row-cont no-brd">
        <h3 class="ven-label">Other Informations:</h3>
        <div class="row">
            <p class="left-side">Reason for Change: {{ finishedProduct.reasonForChange }}</p>
            <p class="left-side">Amount in stock: 0</p>
            <p class="left-side">Amount on Sales Order: 0</p>
            <p class="left-side">Recommended Stock Level: {{ finishedProduct.reorderPoint }}</p>            
        </div> 
        
        {% if competitiveProducts | length > 0 %}
        <div class="property-cont">
            <h4 class="desc-cont no-brd">Competitive Products:</h4>
            <div class="property-row">
                <p>Supplier</p>
                <p>Item Name</p>
                <p>Standard Sales Price</p>
            </div>
            {% for product in competitiveProducts %}
            <div class="property-row property-row-link">
                <p><a href="{{ path('venture_competitive_product_view', {'id': product.id}) }}">{{ product.itemSupplier }}</a></p>
                <p><a href="{{ path('venture_competitive_product_view', {'id': product.id}) }}">{{ product.itemName }}</a></p>
                <p><a href="{{ path('venture_competitive_product_view', {'id': product.id}) }}">{{ product.standardCost }}</a></p>
            </div>
            {% endfor %}
        </div>
        {% endif %}
        
        
        <button class="add-new edit target" data-location="{{ path('venture_finished_product_history',  {'id': id}) }}">History</button>
        <button class="add-new edit target" data-location="{{ path('venture_finished_product_update',  {'id': id}) }}">Edit</button>
        <button class="add-new edit target delete" data-location="{{ path('venture_finished_product_delete',  {'id': id}) }}">Delete</button>
    </div>
    
</div>

{% endblock %} 
